﻿<%@ Page Language="C#" AutoEventWireup="true" MasterPageFile="~/Lapv.Master" CodeBehind="NewsManager.aspx.cs"
    Inherits="Lapv.page.NewsManager" %>

<%@ Register Namespace="ASPnetControls" Assembly="ASPnetPagerV2_8" TagPrefix="cc" %>
<asp:Content ID="Content1" ContentPlaceHolderID="head" runat="server">
</asp:Content>
<asp:Content ID="Content3" ContentPlaceHolderID="header" runat="server">
    <%--menu tab  --%>
    <div class="tabnav">
        <ul>
            <li class="active"><a href="NewsManager.aspx" class="list_d">D/S Tin tức</a></li>
            <li><a href="NewsAdd.aspx" class="add_t">Thêm tin tức</a></li>
            <li><a href="catemanager.aspx" class="list_t">D/S danh mục</a></li>
        </ul>
        <div class="clr">
        </div>
    </div>
</asp:Content>
<asp:Content ID="Content2" ContentPlaceHolderID="content" runat="server">
    <%--box action --%>
    <div class="action">
        <ul>
            <li>
                <label>
                    Chọn loại tin:</label>
                <asp:DropDownList ID="ddlCate" runat="server" OnSelectedIndexChanged="ChangeSelectIndex"
                    AutoPostBack="true">
                </asp:DropDownList>
            </li>
            <li>
                <label>
                    Chọn tình trạng tin:</label>
                <asp:DropDownList ID="ddlStatus" runat="server" OnSelectedIndexChanged="ChangeSelectIndex"
                    AutoPostBack="true">
                    <asp:ListItem Text="---Chọn tình trạng tin---" Value="-1"></asp:ListItem>
                    <asp:ListItem Text="Dùng" Value="1"></asp:ListItem>
                    <asp:ListItem Text="Chờ đăng" Value="2"></asp:ListItem>
                    <asp:ListItem Text="Không dùng" Value="0"></asp:ListItem>
                </asp:DropDownList>
            </li>
        </ul>
        <div class="clr">
        </div>
    </div>
    <%--form2 list - grid -table--%>
    <div class="form form2">
        <asp:DataGrid ID="dtgrid" runat="server" CssClass="table1" AutoGenerateColumns="false"
            OnItemDataBound="dtgrid_ItemDataBound" OnItemCommand="functionGridNews">
            <Columns>
                <asp:TemplateColumn ItemStyle-Width="4%" >
                    <HeaderTemplate>
                        Mã tin</HeaderTemplate>
                    <ItemTemplate>
                        <asp:Label runat="server" ID="lb_id" Text='<%# Eval("id") %>' />
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Tiêu đề tin"   ItemStyle-Width="">
                    <ItemTemplate>
                        <a href="newsadd.aspx?newsid= <%# Eval("Id") %>">
                            <%# Eval("title")%>
                        </a>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Loại tin"   ItemStyle-Width="100">
                    <ItemTemplate>
                        <a href="<%= domain %>Pages/NewsManager.aspx?tid=<%# Eval("news_category.id")%>" style="font-weight: bold;">                        
                            <%# Eval("news_category.name")%>
                        </a>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Ngày tạo"   ItemStyle-Width="120">
                    <ItemTemplate>
                        <%# ((DateTime)DataBinder.Eval(Container.DataItem, "datecreate")).ToString("dd/MM/yyyy hh:mm tt")%>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Trạng thái"   ItemStyle-Width="70">
                    <ItemTemplate>
                        <%#GetNameStatus((sbyte)Eval("status"))%>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Ngày chờ đăng"   ItemStyle-Width="120">
                    <ItemTemplate>
                        <%# ((DateTime)DataBinder.Eval(Container.DataItem, "starttimeup")).ToString("dd/MM/yyyy hh:mm tt")%>
                    </ItemTemplate>
                </asp:TemplateColumn>
               <asp:TemplateColumn HeaderText="Xem bình luận"   ItemStyle-Width="70">
                    <ItemTemplate>
                      <a href="CommentMN.aspx?newsid= <%# Eval("Id") %>">
                            <img alt="Sửa" src="../styles/imgs/sprite_black2_21.png" border="0" />
                        </a>
                    </ItemTemplate>
                </asp:TemplateColumn> 
                <asp:TemplateColumn HeaderText="Sửa"   ItemStyle-Width="70">
                    <ItemTemplate>
                        <asp:LinkButton runat="server" ID="lbtEdit" CommandName="edit" Text='Sửa' CommandArgument='<%# Eval("id") %>'>
                            <img alt="Sửa" src="../styles/imgs/edit.gif" border="0" />
                        </asp:LinkButton>
                    </ItemTemplate>
                </asp:TemplateColumn>
                <asp:TemplateColumn HeaderText="Xóa"   ItemStyle-Width="70">
                    <ItemTemplate>
                        <asp:ImageButton OnClick="btnDelete_Click" ID="btnDelete" ImageUrl="../styles/imgs/delete.gif"
                            runat="server" BorderWidth="0" CommandArgument='<%# Eval("id") %>' OnClientClick="return confirm('Xóa tin vĩnh viễn?')" />
                    </ItemTemplate>
                </asp:TemplateColumn>
            </Columns>
        </asp:DataGrid>
    </div>
    <%--form1 add & edit--%>
    <div class="form pager">
        <div class="p_ddl">
            Number Record:
            <asp:DropDownList ID="ddlPaged" runat="server" AutoPostBack="true" OnSelectedIndexChanged="ddlPaged_SelectedIndexChanged">
            </asp:DropDownList>
        </div>
        <div class="p_pager">
            <cc:PagerV2_8 ID="pager1" runat="server" OnCommand="pager_Command" GenerateGoToSection="true" />
        </div>
    </div>
</asp:Content>
